<?php
    // 查询 chanpin 表
    function get_chanpin_data(){
        $result = mysql_query("SELECT * FROM chanpin");
  
        $results = array();
        while ($row = mysql_fetch_assoc($result)) {
            $results[] = $row;
        }

        $arrData = createJsonData($results);
    
        echo json_encode($arrData);
    }

    // 添加 chanpin 数据
    function insert_chanpin_data(){
        $chanpinid = time() * 3;
        mysql_query("insert into chanpin 
        (chanpinid , leibieid , pinpaiid , name , zhuangtai)  
        values 
        ('$chanpinid' , '$_POST[leibieid]' , '$_POST[pinpaiid]' , '$_POST[name]' , '$_POST[zhuangtai]')");
        
    }

    // 删除 chanpin 数据
    function delete_chanpin_data(){
        mysql_query("delete from chanpin where Id='$_GET[Id]'");
    }



?>